Socket
Socket
Sign inDemoInstall

ts-invariant

Package Overview
Dependencies
1
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ts-invariant

TypeScript implementation of invariant(condition, message)


Version published
Weekly downloads
4.2M
decreased by-6.28%
Maintainers
1
Install size
50.9 kB
Created
Weekly downloads
 

Package description

What is ts-invariant?

The ts-invariant package provides utility functions for asserting invariants within TypeScript applications. It is designed to throw errors when certain conditions are not met, which can be useful for catching programming errors and enforcing certain constraints at runtime.

What are ts-invariant's main functionalities?

Invariant

The invariant function is used to assert that a condition is true. If the condition is false, it will throw an error with the provided error message.

import { invariant } from 'ts-invariant';
invariant(condition, 'Expected condition to be true');

Invariant.warn

The invariant.warn function is used to log a warning message to the console. It does not throw an error.

import { invariant } from 'ts-invariant';
invariant.warn('This is a warning message');

Invariant.error

The invariant.error function is used to log an error message to the console. It does not throw an error.

import { invariant } from 'ts-invariant';
invariant.error('This is an error message');

Other packages similar to ts-invariant

Readme

Source

ts-invariant

TypeScript implementation of invariant(condition, message).

Keywords

FAQs

Last updated on 07 Jun 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc